import  Icon from '@/components/Icon.vue'
import {  ElDropdown, ElDropdownItem, ElDropdownMenu, ElTooltip } from 'element-plus'
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'

// 权限管理相关
export const useManagement = () => {
  const router = useRouter()

  const { t } = useI18n()

  function handleChange() {
    
  }


  // 切换按钮
  const PermissonManagement = () => (
    <ElTooltip content={t('quan-xian-guan-li')}>
      <ElDropdown onCommand={handleChange}>
        {{
          default: () => <Icon icon="mdi:account-cog-outline" class="mr-3 p-0.5"/>,
          dropdown: () => (
            <ElDropdownMenu>
              <ElDropdownItem
                onClick={() => {
                  router.push('/role')
                }}
              >
                角色管理
              </ElDropdownItem>
              <ElDropdownItem
                onClick={() => {
                  router.push('/user')
                }}
              >
                用户管理
              </ElDropdownItem>
            </ElDropdownMenu>
          )
        }}
      </ElDropdown>
    </ElTooltip>
  )
  return {
    PermissonManagement
  }
}


